﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;

using Lottery.Control;

namespace Lottery.MediaData.UI.Control {
    public partial class MediaDataInput : UserControl {
        public MediaDataInput() {
            InitializeComponent();

            controls.Add(eachMediaData1);
            controls.Add(eachMediaData2);
            controls.Add(eachMediaData3);
            controls.Add(eachMediaData4);
            controls.Add(eachMediaData5);
            controls.Add(eachMediaData6);
            controls.Add(eachMediaData7);
            controls.Add(eachMediaData8);
            controls.Add(eachMediaData9);
            controls.Add(eachMediaData10);
            controls.Add(eachMediaData11);
            controls.Add(eachMediaData12);
            controls.Add(eachMediaData13);
            controls.Add(eachMediaData14);
        }

        private List<EachMediaData> controls = new List<EachMediaData>();

        public EachMediaData this[int index] {
            get { return controls[index]; }
        }

        public int Count { get { return controls.Count; } }

        public void ClearData() {
            for (int i = 0; i < controls.Count; i++) {
                EachMediaData emd = controls[i];
                emd.Clear();
            }
        }

        public void SetCC(List<int> cc) {
            var list = cc;
            var cl = new List<EachMediaData>();
            for (int i = 0; i < this.Count; i++) {
                var item = this[i];
                var isOK = list.IndexOf(i) != -1;
                item.Enabled = isOK;
                if (isOK) cl.Add(item);
            }

            for (int i = 0; i < cl.Count; i++) {
                if (i < cl.Count - 1) {
                    cl[i].JumpToNext = cl[i + 1];
                }
            }
        }
    }
}
